$('.yzm').click(()=>{
    var phone=$('#phone').val().trim();
    var phoneReg=/^1(3[0-9]|5[189]|8[6789])[0-9]{8}$/;

    if(!phone) {
        layer.msg("请输入手机号", {time: 1500})
    }else if(!phoneReg.test(phone)){
        layer.msg("请输入正确的手机号码", {time: 1500})
    }else{
        //获取验证码
        var time=60;
        var timer=setInterval(()=>{
            time--;
            $('.yzm').html(time+'秒');
            if(time<=0){
                clearInterval(timer);
                $('.yzm').html('再次获取');
            }
        },1000);
    }
})
$(".btn").click(()=>{
    var phone=$('#phone').val().trim();
    var code=$('#code').val().trim();
    var card=$('#card').val().trim();
    var cardReg=/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
    var uname=$('#uname').val().trim();
    if(!uname){layer.msg("请输入申请人姓名",{time:1500})}
    else if(!card){layer.msg("请输入身份证号",{time:1500})}
    else if(!cardReg.test(card)){layer.msg("请输入正确的身份证号",{time:1500})}
    else if(!phone){layer.msg("请输入手机号",{time:1500})}
    else if(!code){layer.msg("请输入验证码",{time:1500})}
    else{
        $.ajax({
            type:'post',
            url:'',
            data:{uname:uname,card:card,phone:phone,code:code},
            success:function (data){
                layer.msg("提交成功",{time:1500});

            },
            error:function () {

            }

        })
    }
})